home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / Xprof / xmeasure / perf.h < prev    next >
C/C++ Source or Header  |  1994-08-01  |  4KB  |  118 lines

  1. /*==================================================================
  2.  *      File :          perf.h
  3.  *      Package:        Xmeasure
  4.  * 
  5.  *      Author :        Aloke Gupta.
  6.  *
  7.  *  (C) Copyright 1992, Aloke Gupta.
  8.  *  All rights granted to University of Illinois Board of Regents.
  9.  *==================================================================*/
  10.  
  11. #ifndef _PROFILE_H_
  12. #define _PROFILE_H_
  13.  
  14. #include <stdio.h>
  15. #include <ctype.h>
  16. #include <string.h>
  17. /*
  18. #include <stdlib.h>
  19. */
  20. #include <values.h>
  21. #include <X11/Xlib.h>
  22. #include <X11/Xutil.h>
  23.  
  24. double gettime();    /* Defined in timer.c */
  25. double getabstime();    /* Defined in timer.c */
  26. double TimeSpent();    /* Defined in timer.c */
  27.  
  28. double median();    /* Defined in main.c */
  29.  
  30. #define DISPHEIGHT 600
  31. #define DISPWIDTH  600
  32. #define MSGHEIGHT   20
  33.  
  34. /* Center the display on the screen */
  35. /*
  36. #define XPOSITION(d,s)  ((DisplayWidth (d,s) - DISPWIDTH )/ 2)
  37. #define YPOSITION(d,s)  ((DisplayHeight(d,s) - DISPHEIGHT)/ 2)
  38. */
  39.  
  40. #define XPOSITION(d,s) ((DisplayWidth (d,s) - DISPWIDTH ) - 16)
  41. #define YPOSITION(d,s) ((DisplayHeight(d,s) - DISPHEIGHT) -  5)
  42.  
  43. /* Maximum number of request types in the X protocol */
  44. #define MAXREQUESTS     128
  45.  
  46. /*
  47.  *The following macros are written for handling the various combinations of
  48.  * parameters for graphics operations
  49.  */
  50. #define NUMGXMODES      2
  51. #define NUMLINESTYLES   2
  52. #define NUMFILLSTYLES   2
  53. #define NUMLINEWIDTHS   4
  54.  
  55. #define MASK2   0x01
  56. #define MASK4   0x03
  57.  
  58. #define GFXSLOTS (NUMGXMODES * NUMLINESTYLES * NUMFILLSTYLES * NUMLINEWIDTHS)
  59. #define GFXINDEX(gxmode, linestyle, fillstyle, linewidth) ( \
  60.  ((gxmode    & MASK2)     ) |    \
  61.  ((linestyle & MASK2) << 1) |    \
  62.  ((fillstyle & MASK2) << 2) |    \
  63.  ((linewidth & MASK4) << 3)    )
  64.  
  65. typedef struct _XD {        /* Some parameters about the display server */
  66.     Display  *display;
  67.     char     *displayname;
  68.     int         screen;
  69.     Visual   *visual;        /* Default visual */
  70.     Colormap cmap;        /* Default color map */
  71.     Window   window;        /* Main window */
  72.     Window   msgwindow;        /* Window for printing messages */
  73.     GC         gc, msggc;        /* GC's for the main and message windows */
  74.     GC         gcarray[GFXSLOTS];    /* GC's for each type of graphics operation */
  75.     unsigned long foreground;
  76.     unsigned long background;
  77.     char     *fgname;
  78.     char     *bgname;
  79.     int sstimeout, ssinterval, sspb, ssae; /* Screen saver preferences */
  80. } XD;
  81.  
  82. typedef enum {
  83.     TRUE = 1, FALSE = 0
  84. } Boolean;
  85.  
  86. #define INVALID -1 /* Marks invalid sizes in the sizepair[] array */
  87. #define MAXSIZEPAIRS 5
  88.  
  89. typedef struct _SizePair {
  90.     int s1;
  91.     int s2;
  92. } SizePair;
  93.  
  94. typedef enum {
  95.     GFX, WIN, TXT
  96. } MsgClass;
  97.  
  98. typedef struct _TestRequest {
  99.     int         number;        /* Xlib number for this message */
  100.     char     *name;        /* Symbolic name for this message */
  101.     MsgClass msgclass;        /* Is this a windowing or a graphics message?*/
  102.     Boolean  dothis;        /* Should xperf run this test ? */
  103.     int (*init)   ();        /* Initialization procedure for test */
  104.     int (*func)   ();        /* Actual test */
  105.     int (*cleanup)();        /* Cleanup procedure after the test */
  106.     SizePair sizepair[MAXSIZEPAIRS]; /* Size of data for test procedure */
  107. } TestRequest;
  108.  
  109. typedef struct _XParams {    /* Parameters passed to the test functions */
  110.     GC         gc;        /* Graphics context for this computation */
  111.     long     itns;        /* No. of iterations. Set by Calibrate() */
  112.     SizePair *sizepair;        /* Size pair for this computation */
  113.     long     size;        /* Single number for size. Set by i_func() */
  114.     long     numobjs;        /* Number of objects processed in one call. */
  115.                 /* Set by i_func() */
  116. } XParams;
  117. #endif /* #ifndef _PROFILE_H_ */
  118.